From: kfraser@localhost.localdomain Date: Wed, 25 Oct 2006 11:30:08 +0000 (+0100) Subject: [XEN] Make memory hypercalls NUMA-aware. X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~15584^2~28 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success//%22http:/www.example.com/cgi/success/?a=commitdiff_plain;h=dfddb95579da3825306f598ba3a317da05f74fbd;p=xen.git [XEN] Make memory hypercalls NUMA-aware. This patch modifies memory ops to use the NUMA-aware page allocator functions. We use the target domain's VCPU0 placement to determine which node's memory to use. We expect the system administrator to utilize the exposed NUMA topology information to help craft guest config files that are NUMA-friendly (use only processors and memory values that will fit within a given node). Signed-off-by: Ryan Harper --- diff --git a/xen/common/memory.c b/xen/common/memory.c index c2827fa59f..9ab62a48ec 100644 --- a/xen/common/memory.c +++ b/xen/common/memory.c @@ -41,6 +41,8 @@ increase_reservation( struct page_info *page; unsigned long i; xen_pfn_t mfn; + /* use domain's first processor for locality parameter */ + unsigned int cpu = d->vcpu[0]->processor; if ( !guest_handle_is_null(extent_list) && !guest_handle_okay(extent_list, nr_extents) ) @@ -58,8 +60,8 @@ increase_reservation( return i; } - if ( unlikely((page = alloc_domheap_pages( - d, extent_order, memflags)) == NULL) ) + if ( unlikely((page = __alloc_domheap_pages( d, cpu, + extent_order, memflags )) == NULL) ) { DPRINTK("Could not allocate order=%d extent: " "id=%d memflags=%x (%ld of %d)\n", @@ -92,6 +94,8 @@ populate_physmap( unsigned long i, j; xen_pfn_t gpfn; xen_pfn_t mfn; + /* use domain's first processor for locality parameter */ + unsigned int cpu = d->vcpu[0]->processor; if ( !guest_handle_okay(extent_list, nr_extents) ) return 0; @@ -111,8 +115,8 @@ populate_physmap( if ( unlikely(__copy_from_guest_offset(&gpfn, extent_list, i, 1)) ) goto out; - if ( unlikely((page = alloc_domheap_pages( - d, extent_order, memflags)) == NULL) ) + if ( unlikely((page = __alloc_domheap_pages( d, cpu, + extent_order, memflags )) == NULL) ) { DPRINTK("Could not allocate order=%d extent: " "id=%d memflags=%x (%ld of %d)\n", @@ -294,7 +298,7 @@ memory_exchange(XEN_GUEST_HANDLE(xen_memory_exchange_t) arg) unsigned long in_chunk_order, out_chunk_order; xen_pfn_t gpfn, gmfn, mfn; unsigned long i, j, k; - unsigned int memflags = 0; + unsigned int memflags = 0, cpu; long rc = 0; struct domain *d; struct page_info *page; @@ -368,6 +372,9 @@ memory_exchange(XEN_GUEST_HANDLE(xen_memory_exchange_t) arg) } d = current->domain; + /* use domain's first processor for locality parameter */ + cpu = d->vcpu[0]->processor; + for ( i = 0; i < (exch.in.nr_extents >> in_chunk_order); i++ ) { if ( hypercall_preempt_check() ) @@ -413,8 +420,8 @@ memory_exchange(XEN_GUEST_HANDLE(xen_memory_exchange_t) arg) /* Allocate a chunk's worth of anonymous output pages. */ for ( j = 0; j < (1UL << out_chunk_order); j++ ) { - page = alloc_domheap_pages( - NULL, exch.out.extent_order, memflags); + page = __alloc_domheap_pages( NULL, cpu, + exch.out.extent_order, memflags); if ( unlikely(page == NULL) ) { rc = -ENOMEM;